//
//  CustomAlertView.m
//  work
//
//  Created by 徐宏飞 on 16/5/19.
//  Copyright © 2016年 方伟. All rights reserved.
//

#import "CustomAlertView.h"

@interface CustomAlertView ()

@property (nonatomic, strong) UILabel *lblTitle;
@property (nonatomic, strong) UILabel *lblContent;

@end

@implementation CustomAlertView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
        [self createTimeAction];
    }
    return self;
}


- (void)createSubView{
    
    UIView *baseView = [[UIView alloc] initWithFrame:self.frame];
    baseView.backgroundColor = BLACK;
    baseView.alpha = 0.5;
    [self addSubview:baseView];
    
    
    UIView *alertView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200*WID, 136*WID)];
    alertView.backgroundColor = WHITE;
    alertView.center = CGPointMake(SCREEN_WIDTH*0.5, SCREEN_HEIGHT*0.5-100);
    [self addSubview:alertView];
    
    
    //title
    self.lblTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100*WID, 30*WID)];
    self.lblTitle.text = @"投递成功";
    self.lblTitle.font = FW_XWID_FONT(24);
    self.lblTitle.textColor = COLOR_THEHE;
    self.lblTitle.center = CGPointMake(alertView.frame.size.width *0.5, 40);
    [alertView addSubview:self.lblTitle];
    
    
    self.lblContent = [[UILabel alloc] initWithFrame:CGRectMake(15, 60, alertView.frame.size.width - 15*2,45)];
    self.lblContent.numberOfLines = 0;
    self.lblContent.textAlignment = NSTextAlignmentCenter;
    self.lblContent.text = @"如被业主看中，客服将电话请保持电话畅通";
    self.lblContent.font = FW_XWID_FONT(14);
    self.lblContent.textColor = UIColorFromRGB(0xE97243);
    [alertView addSubview:self.lblContent];
    
    
}


- (void)createTimeAction{
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self removeFromSuperview];
    });

}




@end
